<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	template="/WEB-INF/templates/public/default.xhtml"
>

	<f:metadata>
		<f:viewParam
			name="serviceBuyerId"
			value="#{serviceBuyerHome.id}"
		></f:viewParam>
		<f:event
			listener="#{serviceBuyerHome.initConversation()}"
			type="preRenderView"
		></f:event>
	</f:metadata>

	<ui:define name="head">
		<style type="text/css">
			.removeButton {
				float: right;
				margin-right: 20px;
			}
			
			td {				
				padding-bottom: 10px;
			}
			
			label {
				font-weight: bold;
			}
		</style>
		<h:outputStylesheet name="css/public/newuser-registration.css" />
		
	</ui:define>

	<ui:define name="content">

		<div class="sub_wrap">
			<div class="Methbox_tit">
				<h2>采购人用户注册</h2>
				<span><p:link
					outcome="/index.xhtml"
					target="_blank"
				>平台首页</p:link> &gt;用户注册</span>
			</div>
			<div class="Methbox_con">
				<!--注册过程-->
				<div class="register-guocheng">
					<div class="fleft rg-guocheng nureg-cont">
						<span class="rg-span"> 1</span>
						<h4 class="rg-h4">平台注册协议</h4>
					</div>
					<div class="fleft rg-guocheng">
						<span class="rg-span"> 2</span>
						<h4 class="rg-h4">填写账号信息</h4>
					</div>
					<div class="fleft rg-guocheng2">
						<span class="rg-span2"> 3</span>
						<h4 class="rg-h42">注册成功</h4>
					</div>
					<div class="clearbt"></div>
					<div class="reghr-box">
						<hr class="reghr" style="width: 75%" />
					</div>
				</div>
				<h:form id="editForm">
					<p:messages id="messages" autoUpdate="true"/>
					<p:panel
						id="baseInfo"
						style="margin-bottom:10px;"
						styleClass="nureg-cont nuregcbox nuregcboxsty"
					>
			
						<h:panelGrid
							columns="2"
							cellpadding="5"
						>
						
							<p:outputLabel
								for="cnname"
								value="用户名称"
							/>
							<p:inputText
								id="cnname"
								value="#{serviceBuyerHome.instance.cnname}"
								required="true"
								readonly="#{serviceBuyerHome.managed}"
							>
								<f:validator binding="#{cnnameValidator}" disabled="#{serviceBuyerHome.managed}"></f:validator>
								<f:ajax render="@this" />
							</p:inputText>

							<p:outputLabel
								for="creditCode"
								value="统一社会信用代码"
								rendered="#{not serviceBuyerHome.managed}"
							></p:outputLabel>
							<p:inputText id="creditCode"
										value="#{serviceBuyerHome.instance.creditCode}"
										required="true"
										rendered="#{not serviceBuyerHome.managed}">

								<f:validator binding="#{buyerCreditcodeValidator}"></f:validator>
								<f:ajax render="@this"/>
							</p:inputText>
						
							<p:outputLabel
								for="username"
								value="山东政务服务门户网站登录名"
								rendered="#{not serviceBuyerHome.managed}"
							/>
							<p:inputText
								id="username"
								value="#{serviceBuyerHome.instance.username}"
								required="true"
								rendered="#{not serviceBuyerHome.managed}"
							>
								<f:validator binding="#{usernameValidator}"></f:validator>
								<f:ajax render="@this" />
							</p:inputText>
							
							<p:outputLabel
								for="email"
								value="邮箱"
								rendered="#{not serviceBuyerHome.managed}"
							/>
							<p:inputText
								id="email"
								value="#{serviceBuyerHome.instance.email}"
								required="true"
								rendered="#{not serviceBuyerHome.managed}"
							>
								<f:validator binding="#{emailValidator}"></f:validator>
								<f:ajax render="@this" />
							</p:inputText>
						
							<p:outputLabel for="legalPerson" value="法定代表人"></p:outputLabel>
							<p:inputText id="legalPerson"
										value="#{serviceBuyerHome.instance.legalPerson}"
										required="true"></p:inputText>
						
							<p:outputLabel for="legalPersonPhoneNumber" value="法人联系电话"></p:outputLabel>
							<p:inputText id="legalPersonPhoneNumber"
										value="#{serviceBuyerHome.instance.legalPersonPhoneNumber}"
										required="true"></p:inputText>
							
							<p:outputLabel
								for="firstContactor"
								value="第一联系人"
							/>
							<p:inputText
								id="firstContactor"
								value="#{serviceBuyerHome.instance.firstContactor}"
								required="true"
							/>
							<p:outputLabel
								for="firstContactorPhoneNumber"
								value="第一联系人电话"
							/>
							<p:inputText
								id="firstContactorPhoneNumber"
								value="#{serviceBuyerHome.instance.firstContactorPhoneNumber}"
								required="true"
							/>
							<p:outputLabel
								for="secondContactor"
								value="第二联系人"
							/>
							<p:inputText
								id="secondContactor"
								value="#{serviceBuyerHome.instance.secondContactor}"
							/>
							<p:outputLabel
								for="secondContactorPhoneNumber"
								value="第二联系人电话"
							/>
							<p:inputText
								id="secondContactorPhoneNumber"
								value="#{serviceBuyerHome.instance.secondContactorPhoneNumber}"
							/>
							
							<p:outputLabel
								for="buyerType"
								value="用户类型"
							/>
							<p:selectOneMenu
								id="buyerType"
								value="#{serviceBuyerHome.instance.buyerType}"
								required="true"
							>
								<f:selectItem
									itemLabel="请选择"
									itemValue="#{null}"
								/>
								<f:selectItem
									itemLabel="个人"
									itemValue="个人"
								/>
								<f:selectItem
									itemLabel="公司单位"
									itemValue="公司单位"
								/>
							</p:selectOneMenu>
							<p:outputLabel
									for="region"
									value="所在县区"
							/>
							<p:selectOneMenu id="region"
											 value="#{serviceBuyerHome.instance.region}"
											 required="true">
								<f:selectItem itemLabel="请选择" itemValue="#{null}"  />
								<f:selectItems value="#{codeDicUtils.getCodeDicList('所在地区')}" var="_codeDic" itemValue="#{_codeDic.codeValue}"
											   itemLabel="#{_codeDic.codeName}" />
							</p:selectOneMenu>
							<p:outputLabel
								for="address"
								value="地址"
							/>
							<p:inputText
								id="address"
								value="#{serviceBuyerHome.instance.address}"
								styleClass="input-large"
							/>
						</h:panelGrid>
					</p:panel>
					<p:tooltip for="username" position="right" value="此登录名为山东政务服务网登录名（请到个人中心查看，不一定为手机号），无用户的需要先去山东政务服务网注册，请填写真实信息，否则无法登陆本系统！" />
					<p:commandButton
						action="#{serviceBuyerHome.saveAndFlush()}"
						value="注册"
						ajax="true"
						update="@form"						
					/>
					<p:commandButton
						action="#{serviceBuyerHome.cancel()}"
						value="取消"
						immediate="true"
					></p:commandButton>
		
				</h:form>
			</div>
		</div>
	</ui:define>

</ui:composition>
